Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

338
Visualizações
How can I enable and hide [list, button, images,..etc ]by using props

so this is the component:

<ReusedHeader
  H1headerGray="text... "
  H2headerRed="text2 ! "
  pheader="p1"
  getStarted="button text1"
  hrefab="button url 1"
  whatWeDo="button text2"
  hrefbb="button url 2"
  imageSrc="image url"
/>;

the list in the component :

<li className=" hover:ring active:ring-4 w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-red-600 hover:bg-red-700 md:py-4 md:text-lg md:px-10">
  {getStarted}
</li>

And this component I will use in many places; in some places, I want the component without buttons;

how can I enable and disable buttons if possible?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can just pass the needed props and handle the logic within the component

const ReusedHeader = ({buttonsEnabled=true}) => {
    if(buttonsEnabled){ // return something }
    else { // return something else }
}

Or modify the onClick if you want the same markup without onClick functionality.

onClick={buttonsEnabled? onClick : undefined}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda